package view.components;

import java.awt.Component;

import javax.swing.tree.TreePath;

import view.listeners.IpAddressTablePopupListener;
import view.listeners.NetworkTreePopUpListener;

public class NetworkTreePopUp {

	public NetworkTreePopUp(int x, int y, TreePath item, NetworkTree tree) {
		super();
		NetworkTreePopUpListener listener = new NetworkTreePopUpListener(item,tree);

		PopUpBuilder popup = new PopUpBuilder();
		if (item != null) {
			if (tree.getSelectedNode().getLevel()==1){
			popup.addButton("Host Löschen", listener);
			popup.addButton("Subnetz zu Host hinzufügen", listener);
			popup.addButton("Host Info", listener);
			}
			if (tree.getSelectedNode().getLevel()==2){
				popup.addButton("Subnetz löschen", listener);
				popup.addButton("IP zu Subnetz hinzufügen", listener);
				popup.addButton("Subnetz Info", listener);
			}
		} else {
			popup.addButton("Neues Host-Netz anlegen", listener);
		}

		popup.show(x, y);
	}

}
